Instead of ‘login’ and ‘password’ use your credentials from https://app.dataforseo.com/api-dashboard
<?php // You can download this file from here https://api.dataforseo.com/v3/_examples/php/_php_RestClient.zip require('RestClient.php'); $api_url = 'https://api.dataforseo.com/'; try { // Instead of 'login' and 'password' use your credentials from https://app.dataforseo.com/api-dashboard $client = new RestClient($api_url, null, 'login', 'password'); } catch (RestClientException $e) { echo "\n"; print "HTTP code: {$e->getHttpCode()}\n"; print "Error code: {$e->getCode()}\n"; print "Message: {$e->getMessage()}\n"; print $e->getTraceAsString(); echo "\n"; exit(); } try { // using this method you can get information about current user // GET /v3/appendix/user_data $result = $client->get('/v3/appendix/user_data'); print_r($result); // do something with result } catch (RestClientException $e) { echo "\n"; print "HTTP code: {$e->getHttpCode()}\n"; print "Error code: {$e->getCode()}\n"; print "Message: {$e->getMessage()}\n"; print $e->getTraceAsString(); echo "\n"; } $client = null; ?>
The above command returns JSON structured like this:
{ "version": "3.20191128", "status_code": 20000, "status_message": "Ok.", "time": "0.5240 sec.", "cost": 0, "tasks_count": 1, "tasks_error": 0, "tasks": { "0": { "id": "11141107-0696-0064-0000-0b3c7677dfa4", "post_id": "0", "status_code": 20000, "status_message": "Ok.", "time": "0.2216 sec.", "cost": 0, "result_count": 1, "path": [ "v3", "appendix", "user_data" ], "data": { "api": "appendix", "function": "user_data" }, "result": [ { "login": "test@gmail.com", "timezone": "Europe", "rates": { "limits": { "day": { "keywords_data": { "live": { "keywords_for_site": 0, "search_volume": 0 }, "task_get": { "keywords_for_site": 0, "search_volume": 0 }, "task_post": { "keywords_for_site": 0, "search_volume": 0 } }, "total_keywords_data": 0, "serp": { "live": { "advanced": 0, "html": 0, "regular": 0 }, "task_get": { "advanced": 0, "html": 0, "regular": 0 }, "task_post": 0, "tasks_ready": 0 }, "total_serp": 0 }, "minute": { "keywords_data": { "live": { "keywords_for_site": 0, "search_volume": 0 }, "task_get": { "keywords_for_site": 0, "search_volume": 0 }, "task_post": { "keywords_for_site": 0, "search_volume": 0 } }, "total_keywords_data": 0, "serp": { "live": { "advanced": 0, "html": 0, "regular": 0 }, "task_get": { "advanced": 0, "html": 0, "regular": 0 }, "task_post": 0, "tasks_ready": 0 }, "total_serp": 0 } }, "statistics": { "day": { "keywords_data": { "live": { "keywords_for_site": 0, "search_volume": 0 }, "task_get": { "keywords_for_site": 0, "search_volume": 0 }, "task_post": { "keywords_for_site": 0, "search_volume": 0 } }, "total_keywords_data": 0, "serp": { "live": { "advanced": 0, "html": 0, "regular": 0 }, "task_get": { "advanced": 0, "html": 0, "regular": 0 }, "task_post": 0, "tasks_ready": 0 }, "total_serp": 0, "value": "2019-11-14" }, "minute": { "keywords_data": { "live": { "keywords_for_site": 0, "search_volume": 0 }, "task_get": { "keywords_for_site": 0, "search_volume": 0 }, "task_post": { "keywords_for_site": 0, "search_volume": 0 } }, "total_keywords_data": 0, "serp": { "live": { "advanced": 0, "html": 0, "regular": 0 }, "task_get": { "advanced": 0, "html": 0, "regular": 0 }, "task_post": 0, "tasks_ready": 0 }, "total_serp": 0, "value": "2019-11-14 09:07" } } }, "money": { "total": 1127004, "balance": 1116220.9, "limits": { "day": { "keywords_data": { "live": { "keywords_for_site": 0, "search_volume": 0 }, "task_get": { "keywords_for_site": 0, "search_volume": 0 }, "task_post": { "keywords_for_site": 0, "search_volume": 0 } }, "total_keywords_data": 0, "serp": { "live": { "advanced": 0, "html": 0, "regular": 0 }, "task_get": { "advanced": 0, "html": 0, "regular": 0 }, "task_post": 0, "tasks_ready": 0 }, "total_serp": 0 }, "minute": { "keywords_data": { "live": { "keywords_for_site": 0, "search_volume": 0 }, "task_get": { "keywords_for_site": 0, "search_volume": 0 }, "task_post": { "keywords_for_site": 0, "search_volume": 0 } }, "total_keywords_data": 0, "serp": { "live": { "advanced": 0, "html": 0, "regular": 0 }, "task_get": { "advanced": 0, "html": 0, "regular": 0 }, "task_post": 0, "tasks_ready": 0 }, "total_serp": 0 } }, "statistics": { "day": { "keywords_data": { "live": { "keywords_for_site": 0, "search_volume": 0 }, "task_get": { "keywords_for_site": 0, "search_volume": 0 }, "task_post": { "keywords_for_site": 0, "search_volume": 0 } }, "total_keywords_data": 0, "serp": { "live": { "advanced": 0, "html": 0, "regular": 0 }, "task_get": { "advanced": 0, "html": 0, "regular": 0 }, "task_post": 0, "tasks_ready": 0 }, "total_serp": 0, "value": "2019-11-14" }, "minute": { "keywords_data": { "live": { "keywords_for_site": 0, "search_volume": 0 }, "task_get": { "keywords_for_site": 0, "search_volume": 0 }, "task_post": { "keywords_for_site": 0, "search_volume": 0 } }, "total_keywords_data": 0, "serp": { "live": { "advanced": 0, "html": 0, "regular": 0 }, "task_get": { "advanced": 0, "html": 0, "regular": 0 }, "task_post": 0, "tasks_ready": 0 }, "total_serp": 0, "value": "2019-11-14 09:07" } } }, "price": { "keywords_data": { "live": { "search_volume": { "priority_low": { "price_type": "per_result", "price": 0.05 }, "priority_normal": { "price_type": "per_result", "price": 0.05 }, "priority_high": { "price_type": "per_result", "price": 0.05 } } }, "task_get": { "search_volume": { "priority_low": { "price_type": "per_result", "price": 0.05 }, "priority_normal": { "price_type": "per_result", "price": 0.05 }, "priority_high": { "price_type": "per_result", "price": 0.05 } } }, "task_post": { "search_volume": { "priority_low": { "price_type": "per_result", "price": 0.05 }, "priority_normal": { "price_type": "per_result", "price": 0.05 }, "priority_high": { "price_type": "per_result", "price": 0.05 } } } }, "serp": { "live": { "advanced": { "priority_low": { "price_type": "per_result", "price": 0 }, "priority_normal": { "price_type": "per_result", "price": 0 }, "priority_high": { "price_type": "per_result", "price": 0 } }, "html": { "priority_low": { "price_type": "per_result", "price": 0 }, "priority_normal": { "price_type": "per_result", "price": 0 }, "priority_high": { "price_type": "per_result", "price": 0 } }, "regular": { "priority_low": { "price_type": "per_result", "price": 0.05 }, "priority_normal": { "price_type": "per_result", "price": 0.05 }, "priority_high": { "price_type": "per_result", "price": 0.05 } } }, "task_get": { "advanced": { "priority_low": { "price_type": "per_result", "price": 0.05 }, "priority_normal": { "price_type": "per_result", "price": 0.05 }, "priority_high": { "price_type": "per_result", "price": 0.05 } }, "html": { "priority_low": { "price_type": "per_result", "price": 0.05 }, "priority_normal": { "price_type": "per_result", "price": 0.05 }, "priority_high": { "price_type": "per_result", "price": 0.05 } }, "regular": { "priority_low": { "price_type": "per_result", "price": 0.05 }, "priority_normal": { "price_type": "per_result", "price": 0.05 }, "priority_high": { "price_type": "per_result", "price": 0.05 } } }, "task_post": { "priority_low": { "price_type": "per_result", "price": 0.05 }, "priority_normal": { "price_type": "per_result", "price": 0.05 }, "priority_high": { "price_type": "per_result", "price": 0.05 } }, "tasks_ready": { "priority_low": { "price_type": "per_result", "price": 0 }, "priority_normal": { "price_type": "per_result", "price": 0 }, "priority_high": { "price_type": "per_result", "price": 0 } } } } } ] } } }
You will receive detailed information about your API usage, prices, spending and other account details by calling this API.
As a response of the API server, you will receive JSON-encoded data containing a tasks
array with the information specific to the set tasks.
Field name | Type | Description |
---|---|---|
version |
string | the current version of the API |
status_code |
integer | general status code you can find the full list of the response codes here Note: we strongly recommend designing a necessary system for handling related exceptional or error conditions |
status_message |
string | general informational message you can find the full list of general informational messages here |
time |
string | total execution time, seconds |
cost |
float | total tasks cost, USD |
tasks_count |
integer | the number of tasks in the tasks array |
tasks_error |
integer | the number of tasks in the tasks array returned with an error |
tasks |
array | array of tasks |
id |
string | task identifier unique task identifier in our system in the UUID format |
status_code |
integer | status code of the task generated by DataForSEO, can be within the following range: 10000-60000 you can find the full list of the response codes here |
status_message |
string | informational message of the task you can find the full list of general informational messages here |
time |
string | execution time, seconds |
cost |
float | cost of the task, USD |
result_count |
integer | number of elements in the result array |
path |
array | URL path |
data |
array | contains the parameters passed in the URL of the GET request |
result |
array | array of results |
login |
integer | your login |
timezone |
string | your time zone can be set in your profile settings |
rates |
array | your API rates |
limits |
array | rate limits for API calls per a certain period of time |
$type_of_grouping |
array | type of grouping can take the following values: day , minute |
$func_name |
array | function name |
$func_type |
array | function type |
$func_name |
integer | calls limit for a certain function |
total_$func_name |
integer | total calls limit for a certain function |
statistics |
array | statisctics for API calls |
$type_of_grouping |
array | type of grouping can take the following values: day , minute |
$func_name |
array | function name |
$func_type |
array | function type |
$func_name |
integer | number of calls for a certain function |
total_$func_name |
integer | total number of calls for a certain function |
value |
string | time period for groupingday in the yyyy-MM-dd formatminute in the yyyy-MM-dd HH:mm format |
money |
array | section of your spending, USD |
total |
float | total amount of money deposited to your account |
balance |
float | amount of money left in your account |
limits |
array | cost limits |
$type_of_grouping |
array | type of grouping can take the following values: day , minute |
$func_name |
array | function name |
$func_type |
array | function type |
$func_name |
integer | spending limit for a certain function |
total_$func_name |
integer | total spending limit for a certain function |
statistics |
array | statistics of your spending |
$type_of_grouping |
array | type of grouping can take the following values: day , minute |
$func_name |
array | function name |
$func_type |
array | function type |
$func_name |
integer | amount of money spent for a certain function |
total_$func_name |
integer | total amount of money spent for a certain function |
value |
string | time period for groupingday in the yyyy-MM-dd formatminute in the yyyy-MM-dd HH:mm format |
price |
array | pricing |
$api_name |
array | the parent API of the function |
$func_type |
array | function type |
$func_name |
array | function name |
$priority |
array | task priority can take the following values: priority_normal , priority_high |
cost_type |
string | charge type can take the following values: per_result – charge for every row in the result arrayper_request – charge for a GET or POST request |
cost |
float | cost, USD |